Method and terminal for starting universal serial USB state machine

ABSTRACT

A method and terminal for starting a USB state machine are provided in the present document. The method includes: connecting a USB voltage bus pin to a logic level; if detecting that a voltage of a charging voltage pin is greater than a threshold limit value, starting a charging state machine and the USB state machine. In the present document, the USB state machine is started through a signal for detecting plug-in and pull-out of a charger, which can not only trigger the start-up of the USB state machine, but also possess a function of satisfying overvoltage protection, thereby the charger and the USB are enabled to share one physical interface with the simplest and securest method under the premise of guaranteeing the reliability.

TECHNICAL FIELD

The present document relates to the field of Universal Serial Bus (USB)communication, and specifically, to a method and terminal for starting aUSB state machine.

BACKGROUND OF THE RELATED ART

A start condition of a charging state machine of a hand-held terminal isto detect whether a Charging Voltage (VCHG) is greater than a certainthreshold limit value (e.g., 3.3V), when an external voltage is greaterthan the value, it is to begin to start the charging state machine andbegin a charging management, otherwise the charging is stopped.

A start condition of a USB state machine of a hand-held terminal is todetect whether a voltage of a USB Voltage Bus (USB_VBUS) end is greaterthan a Session value (e.g., 2.0V) in the USB specification, when anexternal voltage is greater than the value, it is to begin to start aUSB enumeration process, otherwise the USB state machine is stopped.

The China's Ministry of Information Industry (MII) issued TechnicalRequirements and Test Method of Charger and Interface for MobileTelecommunication Terminal Equipment (YD/T1591-2009) in November, 2006,it is formulated that a USB communication cable and a USB charging cableare an identical cable in a handset, that is, the cable can serve as acharging cable and also can serve as a USB communication cable, thus theVCHG and the USB_VBUS of a charging interface of mobile phone areshorted together. Currently, in the industry, a common practice of a USBstart scheme that a charger and USB communication share one interface isdescribed below.

A. The VCHG and the USB_VBUS are shorted together.

The circuit of this method is comparatively simple, but there exists thefollowing disadvantage, a withstand voltage of the USB_VBUS end ofhand-held terminal chip is lower, which cannot satisfy overvoltageprotection requirements formulated in the Technical Requirements andTest Method of Charger and Interface for Mobile TelecommunicationTerminal Equipment.

B. The VCHG is used to control the USB_VBUS power-on through a hardwarecircuit.

This scheme can implement the charging overvoltage protection, but thereexists an external circuit, which increases costs.

SUMMARY OF THE INVENTION

The technical problem required to be solved by the present document isto provide a method and terminal for starting a USB state machine, totrigger the start-up of the USB state machine through a signal fordetecting plug-in and pull-out of a charger and possess a function ofsatisfying overvoltage protection.

In order to solve the above technical problem, the present documentprovides a method for starting a Universal Serial Bus (USB) statemachine, which comprises:

connecting a USB voltage bus pin to a logic level;

if detecting that a voltage of a charging voltage pin is greater than athreshold limit value, starting a charging state machine and the USBstate machine.

Preferably, the above method can further be characterized in that: thelogic level is a high level and the high level is not greater than awithstand voltage value of the USB voltage bus pin, the method furthercomprises: before monitoring the voltage of the charging voltage pin,shielding a USB session interruption.

Preferably, the above method can further be characterized in that: thestep of connecting a USB voltage bus pin to a logic level comprises:grounding the USB voltage bus pin.

Preferably, the above method can further be characterized in that: afterthe step of starting a charging state machine and the USB state machine,the method further comprises: if detecting that the voltage of thecharging voltage pin is less than or equal to the threshold limit value,quitting the USB state machine.

Preferably, the above method can further be characterized in that: thethreshold limit value is 3.3V.

In order to solve the above problem, the present document furtherprovides a terminal, which comprises a Universal Serial Bus (USB)interface, the terminal comprises a logic level module and a managementmodule, wherein a USB voltage bus pin is connected to the logic levelmodule, wherein,

the logic level module is configured to: output a logic level;

the management module is configured to: if detecting that voltage of acharging voltage pin is greater than a threshold limit value, trigger acharging state machine and a USB state machine.

Preferably, the above terminal can further be characterized in that: theterminal further comprises a shielding module, wherein,

the management module is further configured to: if detecting that thelogic level output by the logic level module is a high level and thehigh level is not greater than a withstand voltage value of the USBvoltage bus pin, trigger the shielding module;

the shielding module is configured to: shield a USB sessioninterruption.

Preferably, the above terminal can further be characterized in that: thelogic level module is a grounding module.

Preferably, the above terminal can further be characterized in that: themanagement module is further configured to: after starting the chargingstate machine and the USB state machine, if detecting that the voltageof the charging voltage pin is less than or equal to the threshold limitvalue, quit the USB state machine.

Preferably, the above terminal can further be characterized in that: thethreshold limit value is 3.3V.

In conclusion, a method and terminal for starting a USB state machineare provided in the present document, the USB state machine is startedthrough a signal for detecting plug-in and pull-out of a charger, whichcan not only trigger the start-up of the USB state machine, but alsopossess a function of satisfying overvoltage protection, thereby thecharger and the USB are enabled to share one physical interface with thesimplest and securest method under the premise of guaranteeing thereliability.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic diagram of a terminal according to the example ofthe present document.

FIG. 2 is a flow diagram of a method for a terminal starting a USB statemachine according to the present document.

FIG. 3 is a flow diagram of a method for starting a USB state machineaccording to the example 1 of the present document.

FIG. 4 is a flow diagram of a method for starting a USB state machineaccording to the example 2 of the present document.

PREFERRED EMBODIMENTS OF THE INVENTION

The scheme of the present document is mainly to fix a USB_VBUS pin to acertain kind of logic level, and then through a threshold limit value ofa voltage of a VCHG pin, to trigger a charging state machine and a USBstate machine simultaneously. Compared with other like products, thismethod has the following advantages: no additional components arerequired and costs of hand-held terminal are not increased.

The main characteristic of the present document is to fix the USB_VBUSpin to a certain kind of logic level, the logic level is unrelated tothe VCHG, the hand-held terminal software is utilized to start the USBstate machine according to a level of the VCHG, and a principle of theVCHG starting the USB state machine is described as follows.

(1) The present document relates to two pins within an internal circuitof the hand-held terminal device.

One pin is a Charging Voltage (VCHG) pin, a role of the VCHG pin is todetect a plug-in state and a pull-out state of charger, when a voltagevalue of a VCHG end is greater than a certain threshold limit value(e.g., 3.3V), it is judged that the charger is plugged in, and when thevoltage value of the VCHG end is less than or equal to a certainthreshold limit value (e.g., 3.3V), it is judged that the charger ispulled out.

The other pin is a USB_VBUS pin which provides the power supply for aUSB, when a voltage value of the USB_VBUS end is greater than a Sessionvalue (e.g., 2.0V) in the USB specification, it is judged that a USBcommunication cable is plugged in to start the USB state machine, andwhen a voltage value of the USB_VBUS end is less than or equal to aSession value (e.g., 2.0V) in the USB specification, it is judged thatthe USB communication cable is pulled out.

(2) An operating voltage range of the VCHG is comparatively high, whichis normally from 10 volts to 20 volts (e.g., 18V); and an operatingvoltage range of the USB_VBUS end is comparatively low (e.g., 5.5V).

(3) It is required that a charging cable and the USB communication cableshare an interface according to the Technical Requirements and TestMethod of Charger and Interface for Mobile Telecommunication TerminalEquipment, and it is also required that the charging satisfies anovervoltage protection function, a overvoltage value is about 8V-10V,that is, when an output of the charger is 8V-10V, the hand-held terminalwill not be damaged.

A specific implementation principle of the present document is describedas follows.

In hardware, the USB_VBUS pin is fixed to a certain logic level, and thelogic level is not greater than a withstand voltage value of the USBvoltage bus pin, thus the USB_VBUS pin can be protected.

Since the withstand voltage of USB_VBUS is lower than a threshold limitvalue of overvoltage protection of the charging, when it is charged inovervoltage, the hand-held terminal may be damaged, thus the USB_VBUSpin and the VCHG pin are separated, the USB_VBUS pin is fixed to acertain kind of logic level such as a low logic level (e.g., short tothe ground), or a voltage value of a high logic level (not greater thanthe withstand voltage value of USB_VBUS) is supplied.

In software, the USB state machine is started by detecting the voltagevalue of VCHG.

When the voltage value of VCHG end is greater than 3.3V, the part ofPower Management (PM) in a terminal circuit judges that the charger isplugged in, an interruption request is generated at the meantime, it isto notify the part of base band control in the terminal of that thecharger has been plugged in, it prepares to execute a flow ofcontrolling the USB state machine, and the USB state machine is startedin a flow of the charging state machine in the present document.

In order to better understand the present document, the present documentwill be further described in combination with the accompanying drawingsand specific examples below.

FIG. 1 is a schematic diagram of a terminal according to the example ofthe present document, and as shown in FIG. 1, the terminal of theexample has a USB interface, and the terminal mainly includes a logiclevel module and a management module, wherein a USB_VBUS pin isconnected to the logic level module, wherein,

the logic level module is configured to: output a logic level;

the management module is configured to: if detecting that a voltage of acharging voltage pin is greater than a threshold limit value, trigger acharging state machine and a USB state machine.

The terminal of the example also can include a shielding module, whenthe logic level output by the logic level module is a high level, themanagement module will trigger the shielding module, and the shieldingmodule shields a USB session interruption.

The logic level module can be a grounding module, for example, theUSB_VBUS is directly grounded.

Preferably, after starting the charging state machine and the USB statemachine, the management module is further configured to: if detectingthat the voltage of the charging voltage pin is less than or equal tothe threshold limit value, quit the USB state machine.

FIG. 2 is a flow diagram of a method for a terminal starting a USB statemachine according to the present document, and as shown in FIG. 2, thefollowing steps are included.

In step S10, a USB_VBUS pin is connected to a logic level.

In step S20, if detecting that a voltage of a VCHG pin is greater than athreshold limit value, a charging state machine and a USB state machineare started.

The method for starting the USB state machine according to the presentdocument will be described through two examples below.

Example 1

In hardware, a USB_VBUS pin is connected to a low logic level.

In software, the implementation steps are shown in FIG. 3 as follows.

In step 101, it is to detect whether a voltage value of a VCHG end isgreater than a threshold limit value, if yes, i.e., it is detected thata charger is plugged in, step 102 and step 103 are executed, and if not,no processing is executed.

In step 102, a charging state machine is started, and a battery ischarged.

In step 103, a USB state machine is started, and a USB enumerationprocess is performed.

A sequence for executing step 102 and step 103 is not limited.

In step 104, after the USB state machine is started, if detecting thatthe voltage value of the VCHG end is less than or equal to the thresholdlimit value, the software quits the USB state machine.

Example 2

In hardware, a USB_VBUS pin is connected to a high logic level.

In software, the implementation steps are shown in FIG. 3 as follows.

In step 201, when it is detected that a level of the USB_VBUS pin is thehigh logic level, during an initialization, a USB Session interruptionis shielded, which makes the USB_VBUS pin fail to start a USB statemachine.

In step 202, it is to detect whether a voltage value of a VCHG end isgreater than a threshold limit value, if yes, i.e., it is detected thata charger is plugged in, step 203 and step 204 are executed, and if not,no processing is executed.

In step 203, a charging state machine is started, and a battery ischarged.

In step 204, a USB state machine is started, and a USB enumerationprocess is performed.

A sequence of executing step 203 and step 204 is not limited.

In step 205, after the USB state machine is started, if detecting thatthe voltage value of VCHG end is less than or equal to the thresholdlimit value, the software quits the USB state machine.

The method for the hand-held terminal starting the USB state machinethrough a signal namely the Charging Voltage (VCHG) for detectingplug-in and pull-out of the charger is applied to any terminal productsin which the charger and USB communication share one physical interfacefunction.

The ordinary person skilled in the art can understand that all or partof the steps in the above method can be completed by a programinstructing related hardware, and the program can be stored in acomputer readable memory medium, such as a read-only memory, disk oroptical disk and so on. Alternatively, all or part of the steps of theabove examples also can be implemented by using one or multipleintegrated circuits. Correspondingly, each module/unit in the aboveexamples can be implemented in a form of hardware, and also can beimplemented in a form of software function module. The present documentis not limited to any combination of hardware and software in a specificform.

The above description is only the preferred examples of the presentdocument, Certainly, the present document can still have other variousexamples, the skilled familiar to the art can make various correspondingchanges and transformations according to the present document withoutdeparting from the spirit and essence of the present document, and thesecorresponding changes and transformations shall all fall into theprotection scope of the appended claims of the present document.

INDUSTRIAL APPLICABILITY

A method and terminal for starting a USB state machine are provided inthe present document, the USB state machine is started through a signalfor detecting plug-in and pull-out of a charger, which can not onlytrigger the start-up of the USB state machine, but also possess afunction of satisfying overvoltage protection, thereby the charger andthe USB are enabled to share one physical interface with the simplestand securest method under the premise of guaranteeing the reliability.

What is claimed is:
 1. A method for starting a Universal Serial Bus (USB) state machine, comprising: fixing a USB voltage bus pin to a certain logic level; when detecting that a voltage of a charging voltage pin is greater than a threshold limit value, starting both a charging state machine and a USB state machine; wherein, after the step of starting both the charging state machine and the USB state machine, the method further comprises: when detecting that the voltage of the charging voltage pin is less than or equal to said threshold limit value, quitting both the charging state machine and the USB state machine; thereby both the charging state machine and the USB state machine are started and quit through the voltage of the charging voltage pin for detecting plug-in and pull-out of a charger; wherein, the logic level is a high level and the high level is not greater than a withstand voltage value of the USB voltage bus pin, and the method further comprises: before monitoring the voltage of the charging voltage pin, shielding a USB session interruption; or wherein, the step of fixing the USB voltage bus pin to a logic level comprises: grounding the USB voltage bus pin, and the logic level of the USB voltage bus pin is fixed and will never be changed.
 2. The method according to claim 1, wherein, the threshold limit value is 3.3V.
 3. A terminal, comprising a Universal Serial Bus (USB) interface, said terminal comprising a logic level module and a management module, wherein a USB voltage bus pin is connected to the logic level module, wherein, the logic level module is configured to: output a logic level; thereby the USB voltage bus pin is fixed to a certain logic level; the management module is configured to: when detecting that a voltage of a charging voltage pin is greater than a threshold limit value, trigger both a charging state machine and a USB state machine; wherein the management module is further configured to: after starting both the charging state machine and the USB state machine, when detecting that the voltage of the charging voltage pin is less than or equal to said threshold limit value, quit both the charging state machine and the USB state machine; thereby both the charging state machine and the USB state machine are started and quit through the voltage of the charging voltage pin for detecting plug-in and pull-out of a charger; wherein the terminal further comprises a shielding module; the management module is further configured to: when detecting that the logic level output by the logic level module is a high level and the high level is not greater than a withstand voltage value of the USB voltage bus pin, trigger the shielding module; and the shielding module is configured to: shield a USB session interruption; or wherein the logic level module is a grounding module, and the logic level of the USB voltage bus pin is fixed and will never be changed.
 4. The terminal according to claim 3, wherein, the threshold limit value is 3.3V. 